package com.qk.ezbuy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qk.ezbuy.dao.OrderMapper;
import com.qk.ezbuy.pojo.Order;
import com.qk.ezbuy.pojo.Product;
import com.qk.ezbuy.pojo.User;
import com.qk.ezbuy.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
    public Order selectOrderById(int id) {
        return orderMapper.selectOrderById(id);
    }

    @Override
    public PageInfo<Order> selectUserById(int pageNum, int pageSize,int id) {
        PageHelper.startPage(pageNum,pageSize);
        List<Order> list = orderMapper.selectUserById(id);
        PageInfo<Order> pageInfo = new PageInfo<Order>(list);
        return pageInfo;
    }
    @Override
    public PageInfo<Order> selectPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Order> list = orderMapper.selectPage();
        PageInfo<Order> pageInfo = new PageInfo<Order>(list);
        return pageInfo;
    }

    @Override
    public List<Order> selectProduct() {
        return orderMapper.selectProduct();
    }

    @Override
    public int delOrderById(Order order) {
        return orderMapper.delOrderById(order);
    }


}
